'use strict';

const Controller = require('egg').Controller;

class BaseController extends Controller {
  /* 操作成功，返回数据 */
  async success(reqData) {
    const { ctx } = this;
    ctx.body = { reqCode: 0, reqMsg: 'success', reqData };
  }

  /* 操作失败，返回数据 */
  async error(args) {
    const { ctx } = this;
    const { reqCode, reqMsg } = args;
    ctx.body = { reqCode, reqMsg };
  }
}

module.exports = BaseController;
